package com.ruoyi.pims.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.pims.mapper.RyPurchaseAnalysisMapper;
import com.ruoyi.pims.domain.RyPurchaseAnalysis;
import com.ruoyi.pims.service.IRyPurchaseAnalysisService;
import com.ruoyi.common.core.text.Convert;

/**
 * 采购分析主Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-18
 */
@Service
public class RyPurchaseAnalysisServiceImpl implements IRyPurchaseAnalysisService 
{
    @Autowired
    private RyPurchaseAnalysisMapper ryPurchaseAnalysisMapper;

    /**
     * 查询采购分析主
     * 
     * @param analysisId 采购分析主主键
     * @return 采购分析主
     */
    @Override
    public RyPurchaseAnalysis selectRyPurchaseAnalysisByAnalysisId(Long analysisId)
    {
        return ryPurchaseAnalysisMapper.selectRyPurchaseAnalysisByAnalysisId(analysisId);
    }

    /**
     * 查询采购分析主列表
     * 
     * @param ryPurchaseAnalysis 采购分析主
     * @return 采购分析主
     */
    @Override
    public List<RyPurchaseAnalysis> selectRyPurchaseAnalysisList(RyPurchaseAnalysis ryPurchaseAnalysis)
    {
        return ryPurchaseAnalysisMapper.selectRyPurchaseAnalysisList(ryPurchaseAnalysis);
    }

    /**
     * 新增采购分析主
     * 
     * @param ryPurchaseAnalysis 采购分析主
     * @return 结果
     */
    @Override
    public int insertRyPurchaseAnalysis(RyPurchaseAnalysis ryPurchaseAnalysis)
    {
        ryPurchaseAnalysis.setCreateTime(DateUtils.getNowDate());
        return ryPurchaseAnalysisMapper.insertRyPurchaseAnalysis(ryPurchaseAnalysis);
    }

    /**
     * 修改采购分析主
     * 
     * @param ryPurchaseAnalysis 采购分析主
     * @return 结果
     */
    @Override
    public int updateRyPurchaseAnalysis(RyPurchaseAnalysis ryPurchaseAnalysis)
    {
        return ryPurchaseAnalysisMapper.updateRyPurchaseAnalysis(ryPurchaseAnalysis);
    }

    /**
     * 批量删除采购分析主
     * 
     * @param analysisIds 需要删除的采购分析主主键
     * @return 结果
     */
    @Override
    public int deleteRyPurchaseAnalysisByAnalysisIds(String analysisIds)
    {
        return ryPurchaseAnalysisMapper.deleteRyPurchaseAnalysisByAnalysisIds(Convert.toStrArray(analysisIds));
    }

    /**
     * 删除采购分析主信息
     * 
     * @param analysisId 采购分析主主键
     * @return 结果
     */
    @Override
    public int deleteRyPurchaseAnalysisByAnalysisId(Long analysisId)
    {
        return ryPurchaseAnalysisMapper.deleteRyPurchaseAnalysisByAnalysisId(analysisId);
    }
}
